/*
 * CheaperMatcher.cpp
 *
 *  Created on: Sep 27, 2009
 *      Author: jbarreneche
 */

#include "CheaperMatcher.h"

CheaperMatcher::CheaperMatcher() {
	hitCounter = -1;
	cheaperPosition = -1;
}

CheaperMatcher::~CheaperMatcher() {
}

bool CheaperMatcher::matches(VisitedVertexInfo* another) {
	this->hitCounter++;
	if (this->getCheaperPosition() == -1 ||
		another->getReachCost() < this->getCheaper()->getReachCost()) {
		this->cheaperPosition = this->hitCounter;
		this->cheaper = another;
	}
	return false;
}
int CheaperMatcher::getCheaperPosition() {
	return this->cheaperPosition;
}

VisitedVertexInfo* CheaperMatcher::getCheaper() {
	return this->cheaper;
}
